struct mo_t{ // 莫队算法无修改, 依次调用input(),run(),output()

struct query_t{
    int s;
    int e;
    int idx;
    bool operator < (const query_t & b) const {
        int ln = s / block_size();
        int rn = b.s / block_size();
        if(ln != rn) return ln < rn;
        if(e != b.e) return e < b.e;
        return idx < b.idx;
    }
};

using value_t = int;
using answer_t = int;

vector<value_t> data;      // 原始数组
vector<query_t> questions; // 问题
vector<answer_t> ans;      // 答案

int curLeft, curRight;

static int block_size() {
    static int const BLOCK_SIZE = 300;
    return BLOCK_SIZE;
}

void init(){
    ans.assign(questions.size(), 0);
    sort(questions.begin(), questions.end());

    curLeft = 1; curRight = 0;

    assert(0);
}

void insert(int idx){
    assert(0);
}

void remove(int idx){
    assert(0);
}

answer_t answer(){
    assert(0);
}

void input(){
    assert(0);
}

void run(){
    init();

    for(const auto & q : questions){
        while(curRight < q.e) insert(++curRight);
        while(curLeft > q.s) insert(--curLeft);
        while(curRight > q.e) remove(curRight--);
        while(curLeft < q.s) remove(curLeft++);
        ans[q.idx] = answer();
    }
}

void output(){
    for(auto i : ans) cout << i << " ";
    cout << endl;
}

};
